import { _decorator, Component, Node, Tween, tween, Vec3 } from 'cc';
import { BaseComponent } from '../Manager/UIManager/BaseComponent';
import { GAME_POP } from '../Data/GlobalData';
const { ccclass, property } = _decorator;

@ccclass('PopPass')
export class PopPass extends BaseComponent {

    //标记
    @property(Node)
    public Sign: Node = null;

    //
    public Cb: Function = null;

    protected OnShow(): void {
        Tween.stopAllByTarget(this.Sign);
        this.Sign.setPosition(1000, 0, 0);

        tween(this.Sign).
            to(0.2, { position: new Vec3(0, 0, 0) }).
            delay(1).
            to(0.2, { position: new Vec3(-1000, 0, 0) }).
            call(() => {
                app.popManager.HidePop(GAME_POP.PopPass)
                this.Cb && this.Cb()
            }).
            start();
    }

}


